#include "Log.h"
#include "loghandler.h"
#include "jid.h"
#include "client.h"
#include "connectionlistener.h"
#include "Poco/Util/Application.h"
#include "iostream"
#include "Jingle.h"
#include "Candidate.h"
#include "Transport.h"
#include "Content.h"
#include "JingleExtension.h"

using namespace cm_base;
using namespace cm_xmpp;
using namespace cm_nat;

int main2()
{
    Candidate cd;
    cd.m_ip = "192.168.0.11";
    cd.m_port = 9000;

    cd.m_type = CandidateTypeHost;

    std::cout<< cd.tag()->xml();

    Candidate cd2;
    cd2.parse( cd.tag() );

    std::cout<< cd2.tag()->xml();


    return 0;
}

int main3()
{
    Candidate* p_cand = new Candidate;
    p_cand ->m_ip = "192.168.0.11";
    p_cand ->m_port = 9000;
    p_cand ->m_type = CandidateTypeHost;

    Candidate* p_cand2 = new Candidate;
    p_cand2->m_ip = "192.168.0.11";
    p_cand2->m_port = 9000;
    p_cand2->m_relAddr = "292.168.0.11";
    p_cand2->m_relPort= 2000;
    p_cand2->m_type = CandidateTypeStunReflex;

    Transport tranport;
    tranport.addCandidate( p_cand );

    tranport.addCandidate(p_cand2);

    std::cout << tranport.tag()->xml()<<std::endl;

    Transport tranport2;

    tranport2.parse(tranport.tag());
    std::cout << tranport2.tag()->xml()<<std::endl;


    return 0;

}

int main4()
{
    Candidate* p_cand = new Candidate;
    p_cand ->m_ip = "192.168.0.11";
    p_cand ->m_port = 9000;
    p_cand ->m_type = CandidateTypeHost;

    Candidate* p_cand2 = new Candidate;
    p_cand2->m_ip = "192.168.0.11";
    p_cand2->m_port = 9000;
    p_cand2->m_relAddr = "292.168.0.11";
    p_cand2->m_relPort= 2000;
    p_cand2->m_type = CandidateTypeStunReflex;

    Transport* p_tranport = new Transport;
    p_tranport->addCandidate( p_cand );
    p_tranport->addCandidate(p_cand2);

    Content* p_content = new Content;

    p_content->addTransport( p_tranport );

    std::cout << p_content->tag()->xml()<<std::endl;

    Content content;
    content.parse(p_content->tag());
    std::cout<<content.tag()->xml()<<std::endl;

    return 0;
}

int main()
{
    Candidate* p_cand = new Candidate;
    p_cand ->m_ip = "192.168.0.11";
    p_cand ->m_port = 9000;
    p_cand ->m_type = CandidateTypeHost;

    Candidate* p_cand2 = new Candidate;
    p_cand2->m_ip = "192.168.0.11";
    p_cand2->m_port = 9000;
    p_cand2->m_relAddr = "292.168.0.11";
    p_cand2->m_relPort= 2000;
    p_cand2->m_type = CandidateTypeStunReflex;

    Transport* p_tranport = new Transport;
    p_tranport->addCandidate( p_cand );
    p_tranport->addCandidate(p_cand2);

    Content* p_content = new Content;

    p_content->addTransport( p_tranport );

    std::cout << p_content->tag()->xml()<<std::endl;

    JingleExtension je;
    je.addContent( p_content );

    std::cout << je.tag()->xml()<<std::endl;

    JingleExtension je2;
    je2.parse(je.tag());

    std::cout << je2.tag()->xml()<<std::endl;

    return 0;
}